// pages/address/address.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    address:{
      name:'',
      phone:'',
      detail:''
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var self = this;
    wx.getStorage({
      key: 'address',
      success: function(res) {
        self.setData({
            address:res.data
          })
      },
    })
  },
  submit(e){
    console.log(e.detail)
    const value = e.detail.value;
    
    if (value.name && value.phone && value.detail){
        wx.setStorage({
          key: 'address',
          data: value,
          success(){
            wx.navigateBack();
          }
        })
    }else{
      wx.showModal({
        title: '提示',
        content: '请保证资料完整',
        showCancel:false
      })
    }
  }
})